/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.zr.coverflow.slice;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;


import java.util.ArrayList;

import me.crosswall.coverflow.demo.ResourceTable;
import me.crosswall.lib.coverflow.PageSliderAdapter;
import me.crosswall.lib.coverflow.view.PagerContainer;

/**
 * TwoViewpageabilityslice
 *
 * @since 2021-03-26
 */
public class ViewPageAbilitySlice extends AbilitySlice {
    private PagerContainer pagerContainer;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_view_page);
        pagerContainer = (PagerContainer) findComponentById(ResourceTable.Id_ViewContainerOne);
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(ResourceTable.Media_ic_cover_1);
        arrayList.add(ResourceTable.Media_ic_cover_2);
        arrayList.add(ResourceTable.Media_ic_cover_3);
        arrayList.add(ResourceTable.Media_ic_cover_4);
        arrayList.add(ResourceTable.Media_ic_cover_5);
        arrayList.add(ResourceTable.Media_ic_cover_6);
        arrayList.add(ResourceTable.Media_ic_cover_7);
        arrayList.add(ResourceTable.Media_ic_cover_8);
        PageSliderAdapter bannerAdapter = new PageSliderAdapter(arrayList, this);
        pagerContainer.setPageadapter(bannerAdapter);
        pagerContainer.setCurrpage(0);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
